# num = 1
#
# while num <= 10:
#     print(num)
#     #num = num + 1


# 计算1-100的和
# sum = 0
# num = 1
# while num <= 100:
#     sum = sum + num
#     num = num + 1
# print(f'sum = {sum}')


# 计算5的阶乘
# result = 1
# num = 1
# while num <= 5:
#     result *= num
#     num += 1
# print(result)


#sum表示最终的加和结果
sum = 0
num = 1
while num <= 5:
    # 先算出当前的num！是多少，往sum上进行累加
    factorResult = 1
    i = 1
    while i <= num:
        factorResult *= i
        i += 1
    sum += factorResult
    num += 1
print(f'sum = {sum}')
